package com.ag.dgm.dao;

import javax.annotation.Resource;

import org.hibernate.HibernateException;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.Transaction;

import com.ag.bean.TbEventReport;
import com.ag.dao.TbUserRoleDAO;

public class TbEventReportDAO extends com.ag.dao.TbEventReportDAO{

	@Resource(name="TbUserRoleDAO")
	private com.ag.dao.TbUserRoleDAO tbUserRoleDAO;
	
	public void deleteEventRole(String eid){
		String hql="delete TbUserRole t where t.tbEvent.EId = "+eid;
		Session session = (Session) this.getSessionFactory().openSession();
		try {
			Transaction tx = session.beginTransaction();
			Query query = session.createQuery(hql);
			int count = query.executeUpdate();
			tx.commit();
		} catch (HibernateException e) {
			System.out.println(e.toString());
		} finally {
			session.close();
		}
	}
}
